package main.Q1701_1800;

import java.util.HashMap;
import java.util.Map;

public class Q1791_1800 {
    public static void main(String[] args) {
        System.out.println("Question1791：");
        System.out.println("Question1792：");
        System.out.println("Question1793：");
        System.out.println("Question1794：");
        System.out.println("Question1795：");
        System.out.println("Question1796：");
        System.out.println("Question1797：设计一个验证系统");
        System.out.println("Question1798：");
        System.out.println("Question1799：");
        System.out.println("Question1800：最大升序子数组和");
    }
}

class Question1797{
    Map<String,Integer> map;
    int liveTime;
    public Question1797(int timeToLive) {
        this.map=new HashMap<>();
        this.liveTime=timeToLive;
    }

    public void generate(String tokenId, int currentTime) {
        map.put(tokenId,currentTime+liveTime);
    }

    public void renew(String tokenId, int currentTime) {
        if (map.containsKey(tokenId)&&map.get(tokenId)>currentTime){
            map.put(tokenId,currentTime+liveTime);
        }
    }

    public int countUnexpiredTokens(int currentTime) {
        int count=0;
        for (String key: map.keySet()){
            if (currentTime<map.get(key)) count++;
        }
        return count;
    }
}

class Question1800{
    public int maxAscendingSum(int[] nums) {
        int max=0,temp=nums[0];
        for (int i=1;i< nums.length;i++){
            if (nums[i]>nums[i-1]){
                temp+=nums[i];
            }else {
                max=Math.max(max,temp);
                temp=nums[i];
            }
        }
        max=Math.max(max,temp);//最后一组升序数组
        return max;
    }
}